#!/bin/sh

rm -f core.js

java -server -Xmx2G -Xms2G -Xmn256m -cp 'lib/*:src/main/clojure:src/main/cljs' clojure.main - <<CLJ
(require :reload '[cljs.compiler :as comp] '[clojure.java.io :as io] '[cljs.core])
(comp/compile-file (io/resource "cljs/core.cljs") "core.js")
CLJ

java -jar closure/compiler/compiler.jar \
  --compilation_level=SIMPLE_OPTIMIZATIONS \
  --warning_level=VERBOSE \
  --formatting=PRETTY_PRINT \
  --jscomp_off=missingProperties \
  --js closure/library/closure/goog/base.js \
  --js closure/library/closure/goog/string/string.js \
  --js closure/library/closure/goog/useragent/jscript.js \
  --js closure/library/closure/goog/string/stringbuffer.js \
  --js closure/library/closure/goog/object/object.js \
  --js closure/library/closure/goog/debug/error.js \
  --js closure/library/closure/goog/asserts/asserts.js \
  --js closure/library/closure/goog/array/array.js \
  --js core.js \
  > coresimple.js

java -jar closure/compiler/compiler.jar \
  --compilation_level=ADVANCED_OPTIMIZATIONS \
  --warning_level=VERBOSE \
  --formatting=PRETTY_PRINT \
  --jscomp_off=missingProperties \
  --js closure/library/closure/goog/base.js \
  --js closure/library/closure/goog/string/string.js \
  --js closure/library/closure/goog/useragent/jscript.js \
  --js closure/library/closure/goog/string/stringbuffer.js \
  --js closure/library/closure/goog/object/object.js \
  --js closure/library/closure/goog/debug/error.js \
  --js closure/library/closure/goog/asserts/asserts.js \
  --js closure/library/closure/goog/array/array.js \
  --js core.js \
  > coreadvanced.js

